/**
 * Reflect
*/
const obj = {
  foo: 'foo',
  bar: 'bar'
}

const myProxy = new Proxy(obj, {
  get(target, key, proxy) {

    return Reflect.get(target, key, proxy);
  }
})

console.log(myProxy.foo)

console.log(Reflect.has(obj, 'foo'))
console.log(Reflect.deleteProperty(obj, 'bar'))
console.log(Reflect.ownKeys(obj))

//操作对象出现报错返回false
// 老写法
try {
  Object.defineProperty(target, property, attributes);
  // success
} catch (e) {
  // failure
}
// 新写法
if (Reflect.defineProperty(target, property, attributes)) {
  // success
} else {
  // failure
}

